//
//  YCWithDrawHeadView.m
//  YCVillageDoctor
//
//  Created by zhangji on 2017/6/30.
//  Copyright © 2017年 zhangxiaoliang. All rights reserved.
//

#import "YCWithDrawHeadView.h"
#import "UIViewController+YCExtension.h"
#import "YCTabbarViewController.h"
#import "YCNavViewController.h"

@interface YCWithDrawHeadView ()

@property (strong, nonatomic) UILabel * moneyLabel;

@end


@implementation YCWithDrawHeadView

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self setUPUI];
    }
    
    return self;
}

- (void)setUPUI {

    
    UIImageView *imageBg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"矩形-4"]];
    imageBg.frame = self.bounds;
    [self addSubview:imageBg];
    
    UILabel * middleTitleLabel = [UILabel new];
    middleTitleLabel.text = @"申请提现";
    middleTitleLabel.textColor = [UIColor whiteColor];
    middleTitleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:middleTitleLabel];
    
    [middleTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(30);
    }];
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btn];
    
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.mas_leading).offset(12);
        make.top.equalTo(self.mas_top).offset(30);
        make.size.mas_equalTo(CGSizeMake(20, 30));
    }];
    
    
    UILabel * titleLabel = [UILabel new];
    titleLabel.text = @"我的总业绩 (元)";
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.font = [UIFont systemFontOfSize:13.0];
    [self addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(12);
        make.top.mas_equalTo(self.mas_top).offset(80);
    }];
    
    UILabel * moneyLabel = [UILabel new];
    moneyLabel.text = _moneyString;
    moneyLabel.font = [UIFont systemFontOfSize:80.0];
    moneyLabel.textColor = [UIColor whiteColor];
    [self addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).offset(12);
        make.top.mas_equalTo(titleLabel.mas_bottom).offset(30);
    }];
    
    self.moneyLabel = moneyLabel;

}

- (void)back:(UIButton * )btn {

    YCTabbarViewController * tabVc = (YCTabbarViewController *)[UIViewController yc_getCurrentVc];
    UIViewController * vc = ((YCNavViewController *)tabVc.selectedViewController).topViewController;
    [vc.navigationController popViewControllerAnimated:YES];

}


- (void)setMoneyString:(NSString *)moneyString {

    _moneyString =  moneyString;
    self.moneyLabel.text = _moneyString;
}




@end
